//
//  CookStyleViewController.m
//  project_delicious
//
//  Created by dlios on 15-3-26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CookStyleViewController.h"
#import "LatDetailsViewController.h"
#import "ListViewController.h"
#import "CookStyleCell.h"
#import "MBProgressHUD.h"
@interface CookStyleViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain) MBProgressHUD *HUD;
@end

@implementation CookStyleViewController
- (void)dealloc
{
    [_arr1 release];
    [_arr release];
    [_HUD release];
    [super dealloc];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    self.HUD = self.HUD = [[MBProgressHUD alloc] initWithView:self.view];
    _HUD.labelText = @"Loading";
    //_HUD.color = [UIColor clearColor];
    _HUD.mode = MBProgressHUDModeIndeterminate;
    [self.view addSubview:_HUD];
    [_HUD release];
    [_HUD show:YES];
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBarHidden = YES;
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"IMG_1345.JPG"]];
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 40, self.view.frame.size.width, self.view.frame.size.height-40) style:UITableViewStylePlain];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.backgroundColor = [UIColor clearColor];
    tableView.separatorColor = [UIColor clearColor];
    [self.view addSubview:tableView];
    [tableView release];
    
    [tableView registerClass:[CookStyleCell class] forCellReuseIdentifier:@"guo"];
    //自定义的返回View
    UIView *back = [[UIView alloc] initWithFrame:CGRectMake(0, 20, 30, 30)];
    back.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backToRecomm.png"]];
    back.layer.masksToBounds = YES;
    back.layer.cornerRadius = 15;
    back.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(back)];
    [back addGestureRecognizer:tap];
    [tap release];
    [self.view addSubview:back];
    [back release];

    
    
    
}
//返回
- (void)back
{
    [self.navigationController popViewControllerAnimated:NO];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CookStyleCell *cell = [tableView dequeueReusableCellWithIdentifier:@"guo"];
    cell.name = [self.arr objectAtIndex:indexPath.row];
    cell.backgroundColor = [UIColor clearColor];
    [_HUD removeFromSuperview];
    return cell;   
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ListViewController *details = [[ListViewController alloc] init];
    details.num = [self.arr1 objectAtIndex:indexPath.row];
    [self.navigationController pushViewController:details animated:YES];
    [details release];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
